package com.example.mq;

import com.outstanding.framework.base.mq.MQConsumer;
import com.outstanding.framework.base.mq.MQConsumerType;

public class MyConsumer {
	@MQConsumer(topic = "topic1")
	public void consumer(String str, MyMsg obj) {
		System.out.println("-------topic1-------");
		System.out.println(str);
		System.out.println(obj.demo);
	}

	/**
	 * Rocketmq 同一JVM上，一个消息只会消费一次，即使是选用广播模式，不会被不同方法消费
	 * 
	 * @param hello
	 * @param msg
	 */
	@MQConsumer(topic = "topic2", messageModel = MQConsumerType.PUBLISH_SUBSCRIBE)
	public void consumer2(String hello, MyMsg msg) {
		System.out.println("-------topic2-------");
		System.out.println(hello);
		System.out.println(msg.demo);
		System.out.println(msg.date);
	}


	@MQConsumer(topic = "topic3", messageModel = MQConsumerType.PUBLISH_SUBSCRIBE)
	public void consumer3() {
		System.out.println("-------topic3-------");
	}
}
